<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>登录 - 管理系统</title>
    <link rel="stylesheet" href="../../libs/layui/css/layui.css">
    <style>
        body { background: #f2f2f2; }
        .login-box {
            width: 360px;
            margin: 8% auto 0;
            background: #fff;
            padding: 30px 28px;
            border-radius: 6px;
            box-shadow: 0 6px 18px rgba(0,0,0,0.08);
        }
        .sys-name { text-align:center; font-size:20px; color:#333; margin-bottom:18px; font-weight:600 }
        .login-footer { text-align:center; margin-top:14px; color:#999 }
    </style>
</head>
<body>

    <div class="login-box">
        <div class="sys-name">短时交通流预测平台V1.0</div>

        <form class="layui-form" id="login-form" lay-filter="loginForm">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="username" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-block">
                    <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal layui-btn-fluid" lay-submit lay-filter="doLogin">登录</button>
                </div>
            </div>
        </form>

        <div class="login-footer">© 2025 管理后台</div>
    </div>

    <script src="../../libs/layui/layui.js"></script>
    <script>
        layui.use(['form','layer'], function(){
            var form = layui.form;
            var layer = layui.layer;
            
            // 渲染表单元素
            form.render();

            // 模拟登录提交（本示例不进行真实请求）
            form.on('submit(doLogin)', function(data){
                var field = data.field;
                // 简单验证（用户名: admin, 密码: 123456 为示例）
                if(field.username === 'admin' && field.password === '123456'){
                    layer.msg('登录成功，正在跳转...', {icon:1, time:5000});
                } else {
                    layer.msg('用户名或密码错误', {icon:2});
                }
                return false; // 阻止表单默认提交
            });
        });
    </script>
</body>
</html>
